
package com.way.fileexplorer.activities;


import android.app.AlertDialog;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;

import com.way.fileexplorer.R;

public class SettingActivity extends PreferenceActivity {
    private Preference mAboutPref;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Load the preferences from an XML resource
        addPreferencesFromResource(R.xml.preferences);
        mAboutPref = findPreference("display_version");
    }
    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
            Preference preference) {
        if(preference == mAboutPref){
            View messageView = LayoutInflater.from(this).inflate(R.layout.version_dialog, null); 
            Button okButton = (Button) messageView.findViewById(R.id.version_ok);
            final AlertDialog versionDialog = new AlertDialog.Builder(this).create();
            okButton.setOnClickListener(new View.OnClickListener() {
                
                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    versionDialog.dismiss();
                }
            });
            versionDialog.setTitle(R.string.app_name);
            versionDialog.setView(messageView);
            versionDialog.show();
            return true;
        }else{
            return false;
        }
    }
    

}